package com.bunny.hsu.playground.http;

import android.util.Log;

import com.squareup.okhttp.Call;
import com.squareup.okhttp.Callback;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import java.io.IOException;

/**
 * Created by bunny on 17/3/6.
 */

public class httpProvider {

    private String msg = "null";

    public String post()
    {
        OkHttpClient mokHttpClient = new OkHttpClient();
        final Request request = new Request.
                Builder().
                url("http://10.7.90.181/tuser/?format=json").
                build();
        Call call = mokHttpClient.newCall(request);

        call.enqueue(new Callback() {
            @Override
            public void onFailure(Request request, IOException e) {

            }

            @Override
            public void onResponse(Response response) throws IOException {
                msg = response.body().string();
            }
        });
        return msg;
    }
}